<template>
  <div class="user-info">
    <div class="avatar">
      <slot name="avatar">
        <svg class="icon">
          <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#avatar-default"></use>
        </svg>
      </slot>
    </div>
    <div class="info">
      <slot name="info">
        <p @click="toLogin">登录/注册</p>
      </slot>
    </div>
  </div>
</template>

<script>
import {routerPath} from "@/common/constant";

export default {
  name: "UserInfo",
  methods: {
    toLogin() {
      this.$router.push(routerPath.login)
    }
  }
}
</script>

<style scoped>
.user-info {
  padding: 30px 10px;
  display: flex;
  align-items: center;
  background-color: var(--color-tint);
}

.user-info .icon {
  width: 60px;
  height: 60px;
  background-color: #fff;
  border-radius: 50%;
}

.user-info .info {
  flex: 1;
  margin-left: 20px;
  color: #f6f6f6;
}
</style>